<div class="box">
  <div class="box-header " style="position: relative;">
    
    <ob_link><a class="btn" href="{:url('staffAdd')}"><i class="fa fa-plus"></i> 新 增</a></ob_link>

    &nbsp;
    <!-- <ob_link><a style="display: block;margin-top:3px;" class="btn export" url="{:url('exportStaffBasic')}"><i class="fa fa-download"></i> 基 本 信 息</a></ob_link> -->
    <ob_link><a class="btn exportall" ><i class="fa fa-download"></i> 员 工 导 出</a></ob_link>
    <ob_link><a class="btn dataimportall" ><i class="fa fa-arrow-circle-o-up"></i> 员 工 导 入</a></ob_link>
    <div class="exportalls" style="width: auto;position: absolute;z-index: 1;left: 93px;display: none">
    <!-- <ob_link style="display: block;margin-top:3px;"><a style="background: #605ca8" class="btn export" url="{:url('exportStaffList')}"><i class="fa fa-download"></i> 全 部 信 息</a></ob_link> -->
    <ob_link><a style="background: #605ca8;display: block;margin-top:3px;" class="btn export" url="{:url('exportStaffBasicList')}"><i class="fa fa-download"></i> 基 本 信 息</a></ob_link>
    <ob_link><a style="background: #605ca8;display: block;margin-top:3px;" class="btn export" url="{:url('exportStaffOther', array('type' =>1))}"><i class="fa fa-download"></i> 培 训 经 历</a></ob_link>
    <ob_link><a style="background: #605ca8;display: block;margin-top:3px;" class="btn export" url="{:url('exportStaffOther', array('type' =>2))}"><i class="fa fa-download"></i> 工 作 经 历</a></ob_link>
    <ob_link><a style="background: #605ca8;display: block;margin-top:3px;" class="btn export" url="{:url('exportStaffOther', array('type' =>3))}"><i class="fa fa-download"></i> 员 工 轨 迹</a></ob_link>
    <!-- <ob_link><a style="background: #605ca8;display: block;margin-top:3px;" class="btn export" url="{:url('exportStaffOther', array('type' =>4))}"><i class="fa fa-download"></i> 员 工 月 薪</a></ob_link> -->
    </div>
    <div class="dataimportalls" style="width: auto;position: absolute;z-index: 1;left:208px;display: none">
    <ob_link><a style="background: #00a65a;display: block;margin-top:3px;" class="btn dataimport" url="{:url('staffImport')}" type="1"><i class="fa fa-arrow-circle-o-up"></i> 基 本 信 息</a></ob_link>
    <ob_link><a style="background: #00a65a;display: block;margin-top:3px;" class="btn dataimport" url="{:url('staffImport')}" type="2"><i class="fa fa-arrow-circle-o-up"></i> 培 训 经 历</a></ob_link>
    <ob_link><a style="background: #00a65a;display: block;margin-top:3px;" class="btn dataimport" url="{:url('staffImport')}" type="3"><i class="fa fa-arrow-circle-o-up"></i> 工 作 经 历</a></ob_link>
    <ob_link><a style="background: #00a65a;display: block;margin-top:3px;" class="btn dataimport" url="{:url('staffImport')}" type="4"><i class="fa fa-arrow-circle-o-up"></i> 员 工 轨 迹</a></ob_link>
   <!--  <ob_link><a style="background: #00a65a;display: block;margin-top:3px;" class="btn dataimport" url="{:url('staffImport')}" type="5"><i class="fa fa-arrow-circle-o-up"></i> 员 工 月 薪 </a></ob_link> -->
  </div>
    <!-- <ob_link><a class="btn export" url="{:url('aduitStaff')}"><i class="fa fa-download"></i> 审 核</a></ob_link> -->
    <div class="box-header ajax-form searchAll">
      <div class="col-md-2 col-sm-2 col-2">
          <label>姓名<input type="text" name="staff_name" value="{:input('staff_name')}" class="form-control form-control-sm ajax-form-value" placeholder="请输入姓名" ></label>
      </div>
      <div class="col-md-2 col-sm-2 col-2">
          <label>手机号<input type="text" name="phones" value="{:input('phones')}" class="form-control form-control-sm ajax-form-value" placeholder="请输入手机号" ></label>
      </div>
      <div class="col-md-2 col-sm-2 col-2">
          <label>身份证号<input type="text" name="card_id" value="{:input('card_id')}" class="form-control form-control-sm ajax-form-value" placeholder="请输入姓名" ></label>
      </div>
      <div class="col-md-2 col-sm-2 col-2">
          <label>入职时间<input type="text" name="entry_time" value="{:input('entry_time')}" readonly="readonly" style="cursor:pointer"  class="form-control test-item ajax-form-value" placeholder="请选择时间" ></label>
      </div>
      <div class="col-md-2 col-sm-2 col-2">
          <label>转正时间<input type="text" name="positive_time" value="{:input('positive_time')}" readonly="readonly" style="cursor:pointer"  class="form-control test-item ajax-form-value" placeholder="请选择时间" ></label>
      </div>
      <div class="col-md-2 col-sm-2 col-2">
          <label>生日<input type="text" name="birthday" value="{:input('birthday')}" readonly="readonly" style="cursor:pointer"  class="form-control test-item ajax-form-value" placeholder="请选择时间" ></label>
      </div>
      <div class="col-md-2 col-sm-2 col-2 ggggg">
          <label>公司名
            <select class="form-control form-control-sm ajax-form-value" name="company_id" >
            <option value="">请选择公司名</option>

            {volist name='company_list' id='vo'}
                <option value="{$vo['id']}" {if input('company_id') == $vo['id']} selected="selected" {/if} >{$vo['name']}</option>
            {/volist}
          </select></label>
      </div>
       <div class="col-md-2 col-sm-2 col-2">
          <label>部门名<select class="form-control form-control-sm ajax-form-value" name="branch_id">
            <option value="">请选择部门名</option>
            
            {volist name='branch_list' id='vo'}
                <option value="{$vo['id']}" {if input('branch_id') == $vo['id']} selected="selected" {/if} >{$vo['branch_name']}</option>
            {/volist}
            
          </select></label>
      </div>
      <div class="col-md-2 col-sm-2 col-2">
          <label>组名<select class="form-control form-control-sm ajax-form-value " name="group_id">
            <option value="">请选择组名</option>
            
            {volist name='group_list' id='vo'}
                <option value="{$vo['id']}" {if input('group_id') == $vo['id']} selected="selected" {/if} >{$vo['group_name']}</option>
            {/volist}
            
          </select></label>
      </div>
      <!-- <div class="col-md-2 col-sm-2 col-2">
          <label>审核状态<select class="form-control form-control-sm ajax-form-value" name="audit_status">
            <option value="">请选择审核状态</option>
            <option value="2" {if input('audit_status') == '2'} selected="selected" {/if} >未通过</option>
             <option value="1" {if input('audit_status') == "1"} selected="selected" {/if} >通过</option>
          </select></label>
      </div> -->
      <div class="col-md-2 col-sm-2 col-2">
          <label>在职状态<select class="form-control form-control-sm ajax-form-value" name="w_status">
            <option value="2" {if input('w_status') == '2'} selected="selected" {/if} >在职</option>
             <option value="3" {if input('w_status') == "3"} selected="selected" {/if} >离职</option>
          </select></label>
      </div>
      <div class="col-md-1 col-sm-1 col-1">
          <div class="btn-group pull-right" style="margin-top:20px;margin-right:20px">
              <a href="javascript:;" id="searchAll" class="btn btn-default"  url="{:url('staffList')}">
                  搜索<i class="fa fa-search"></i>
              </a>
          </div>
      </div>
      <div class="col-md-1 col-sm-1 col-1">
        <div class="btn-group pull-right" style="margin-top:20px;margin-right:20px">
            <a href="javascript:;" id="searchclear" class="btn btn-default">
                重置<i class="fa fa-history"></i>
            </a>
        </div>
    </div>

    </div>
    <br/>
  </div>
    
  <div class="box-body table-responsive">
    <table  class="table table-bordered table-hover">
      <thead>
      <tr>
        <th class="checkbox-select-all">
        <label>
          <input class="flat-grey js-checkbox-all" type="checkbox">
        </label>
      </th>
          <th>姓名</th>
          <th>公司</th>
          <th>部门</th>
          <th>手机号</th>
          <th>身份证</th>
          <th>入职时间</th>
          <!-- <th>试用薪资</th> -->
          <th>生日</th>
          <!-- <th>审核状态</th> -->
          <th>在职状态</th>
          {if condition="$w_status eq 3"}
            <th>离职时间</th>
            <th>离职原因</th>
          {/if}
          <th>操作</th>
      </tr>
      </thead>
      
      {notempty name='list'}
        <tbody>
            {volist name='list' id='vo'}
                <tr style="position: relative;">
                   <td>
                    <label>
                        <input class="flat-grey" type="checkbox" name="ids" value="{$vo.id}">
                    </label>
                  </td>
                  <td>{$vo.staff_name}</td>
                  <td>{$vo.name}</td>
                  <td>{$vo.branch_name}</td>
                  <td>{$vo.phones}</td>
                  <td>{$vo.card_id}</td>
                  <td>{$vo.entry_time}</td>
                  <!-- <td>{$vo.probationpay}</td> -->
                  <td>{$vo.birthday}</td>
                 <!--  <td>
                    {if condition="$vo['audit_status'] eq 2"}<span class="badge bg-red"> 未通过</span>{else/}<span class="badge bg-green"> 通过</span> {/if}</td> -->
                  <td>{if condition="$vo['w_status'] eq 2"}<span class="badge bg-green"> 在职</span>{elseif condition="$vo['w_status'] eq 3"/}<span class="badge bg-red"> 离职</span> {/if}</td>
                  {if condition="$w_status eq 3"}
                    <td >{$vo.leave_time}</td>
                    <td style="width: 300px">{$vo.leave_yy}</td>
                    <td class="text-center" style="width:220px;position: relative;">
                  {else/}
                  <td class="text-center" style="width:420px;position: relative;">
                  {/if}
                  
                      <ob_link><a href="{:url('staffEdit', array('id' => $vo['id']))}" class="btn" style="padding:2px 5px"><i class="fa fa-edit"></i> 编 辑</a></ob_link>
                      &nbsp;
                      <ob_link><a class="btn" style="padding:2px 5px"  href ="{:url('staffDetails', array('id' => $vo['id']))}"><i class="fa fa-paste"></i> 详情</a></ob_link>
                      &nbsp;
                      <ob_link><a class="btn layerDel"  style="padding:2px 5px" url="{:url('staffDel', array('id' => $vo['id']))}" href="javascript:void(0)"><i class="fa fa-trash-o"></i> 删 除</a></ob_link>
                      &nbsp;
                      {if condition="$vo['w_status'] eq 2"}
                      <ob_link><a class="btn more_cz" style="padding:2px 5px"><i class="fa fa-hand-o-down"></i> 更 多 </a></ob_link>
                      &nbsp;
                      <div class="more_cz_xs" style="width: auto;position: absolute;z-index: 1;left:281px;display: none;background: #fff;">
                       <ob_link><a class="btn" style="background: #00a65a;display:block;padding:2px 5px;margin-top:1px"  href="{:url('staffPrice', array('id' => $vo['id']))}"><i class="fa fa-cny"></i> 薪 资</a></ob_link>
                      <ob_link><a style="background: #00a65a;display:block;padding:2px 5px;margin-top:1px" class="btn layerAudit" url="{:url('staffAudit', array('id' => $vo['id'],'audit_status'=>$vo['audit_status']))}" href="javascript:void(0)" id="{$vo['audit_status']}"><i class="fa fa-gavel"></i> 审 核</a></ob_link>
                      <ob_link><a style="background: #00a65a;display:block;padding:2px 5px;margin-top:1px" href="{:url('staffEditPosition', array('id' => $vo['id']))}" class="btn editposition"><i class="fa fa-edit"></i> 调 岗</a></ob_link>
                      <ob_link><a style="background: #00a65a;display:block;padding:2px 5px;margin-top:1px" url="{:url('staffWorkAudits', array('id' => $vo['id'],'w_status'=>$vo['w_status']))}" class="btn workaudit"><i class="fa fa-edit"></i> 离 职</a></ob_link>
                      </div> 
                      {/if}                   
                  </td>
                </tr>
            {/volist}
        </tbody>
        {else/}
        <tbody><tr class="odd"><td colspan="8" class="text-center" valign="top">{:config('empty_list_describe')}</td></tr></tbody>
      {/notempty}
    </table>
    <div class="lockscreen-footer">
      <ob_link><a class="btn batch_btn confirm ajax-post" value="{$Think.DATA_DELETE}"  href="{:url('setStatus')}"><i class="fa fa-trash"></i> 删 除</a></ob_link>
    </div>
  </div>

  <div class="box-footer clearfix text-center">
      {$list->render()}
  </div>

</div>
<script src="__STATIC__/module/admin/laydate/laydate.js"></script>
<script src="__STATIC__/module/admin/laydate/layer.js"></script>
<script>

  // $('#company_list').change(function(){
  //   var options=$(this).children("option:selected");
  //    // options.attr('selected','selected'); 
  //   var company_id=options.val();
  //   $('#branch_list option').remove();
  //   $('#group_list option').remove();
  //    $("#group_list").append("<option value=''>请选择组名</option>");
  //    $("#branch_list").append("<option value=''>请选择部门名</option>");
  //   $.post('/admin/branch/branchlist',{company_id:company_id},function(data){
  //     $(data.data).each(function(index,item){ 
  //         var option="<option value="+item.id+">"+item.branch_name+"</option>"
  //         $("#branch_list").append(option);  
  //           // console.log(item); 
  //       }); 
  //   });  
  // })

  // $('#branch_list').change(function(){
  //   var options=$(this).children("option:selected");
  //    options.attr('selected','selected'); 
  //   var branch_id=options.val();
  //   $('#group_list option').remove();
  //    $("#group_list").append("<option value='6'>请选择组名</option>");
  //   // alert(branch_id);
  //   $.post('/admin/group/grouplist',{branch_id:branch_id},function(data){
  //     $(data.data).each(function(index,item){ 
  //         var option="<option value="+item.id+">"+item.group_name+"</option>"
  //         $("#group_list").append(option);  
  //           console.log(item); 
  //       }); 
  //   });  
  // })
  //
  $(".exportall").click(function(){
  $(".exportalls").toggle("slow");
});
  $(".dataimportall").click(function(){
  $(".dataimportalls").toggle("slow");
});

$(".more_cz").click(function(){
  var indexs=$(this).index('.more_cz');
  $(".more_cz_xs").each(function(index,element){
    if(indexs==index){
      $(this).toggle("slow");
    }else{
      $(this).hide("slow");
    }
  });
});
$(document).click(function(){
    $(".exportalls").hide('slow');
});
$(".exportall").click(function(event){
  $(".dataimportalls").hide('slow');
    event.stopPropagation();
});
$(document).click(function(){
    $(".dataimportalls").hide('slow');
});
$(".dataimportall").click(function(event){
  $(".exportalls").hide('slow');
    event.stopPropagation();
});

$(document).click(function(){
    $(".more_cz_xs").hide('slow');
});
$(".more_cz").click(function(event){
    event.stopPropagation();
});
  //导出功能
  $(".export").click(function(){
       $(".exportalls").hide();
       layer.msg('正在导出请稍后!!',{icon:16});
      window.location.href = searchAllFormUrl($(this));
  });
//搜索条件重置
    $('#searchclear').click(function(){
      $('.form-control').val('');
      window.location.href = searchAllFormUrl('#searchAll');
    })
    $('.dataimport').click(function(){
      $(".dataimportalls").hide("slow");
      url=$(this).attr('url');
      type=$(this).attr('type');
      url=url.replace('.html','/')+"type/"+type;
      layer.open({
        type: 2,
        shade: false,
        title: false, //不显示标题
        content:url, //捕获的元素
        area: ['480px','200px']
      });
    })
    // 时间插件
    lay('.test-item').each(function(){
      laydate.render({
        elem: this
        ,trigger: 'click'
        // ,type: 'month' //日期格式
      });
   });

    //员工详情

    // $('.staffDetails').click(function(){
    //   url=$(this).attr('url');
    //   layer.open({
    //     type: 2,
    //     shade: false,
    //     title: false, //不显示标题
    //     content:url, //捕获的元素
    //     area: ['800px','850px']
    //   });
    // })

    $('.layerDel').click(function(){
      var target =$(this).attr('url');
      layer.confirm('您确定要删除吗？', {
        btn: ['确认','取消'] //按钮
      }, function(){
        $.get(target).success(function(data){
          layer.closeAll();
          obalert(data);
        });
      })
    })

     $('.layerAudit').click(function(){
      var target =$(this).attr('url');
      var id=$(this).attr('id')
      var msg='';
      if(id==1){
        msg='您确定审核未通过吗？'
      }else{
        msg='您确定审核通过吗？'
      }
      layer.confirm(msg, {
        btn: ['确认','取消'] //按钮
      }, function(){
        $.get(target).success(function(data){
          layer.closeAll();
          obalert(data);
        });
      })
    })

    $('.workaudit').click(function(){
      var target =$(this).attr('url');
      layer.confirm('你确定已经离职吗', {
        btn: ['确认','取消'] //按钮
      }, function(){
        // $.get(target).success(function(data){
           layer.closeAll();
        //   obalert(data);
        // });
        layer.open({
        type: 2,
        shade: false,
        title: false, //不显示标题
        content:target, //捕获的元素
        area: ['480px','400px']
      });

      })
    })
</script>